package com.example.demo.feign;

import com.example.demo.feign.fallback.DemoFeignApiFallback;
import com.example.demo.model.User;
import feign.Headers;
import feign.Param;
import com.example.demo.config.FeignConfig ;
import feign.RequestLine;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(name = "SERVICE-PROVIDER-API-DEMO1",
        url = "http://localhost:8077",
        configuration = FeignConfig.class,
        fallback = DemoFeignApiFallback.class)
public interface DemoFeignApi {

    @Headers(value={"Content-type:application/json;charset=UTF-8"})
    @RequestLine(value = "POST /feign/provider/user/save")
    //@RequestMapping(value = "/feign/provider/user/save", method = RequestMethod.POST)
    @ResponseBody
    String userSave(@RequestBody User user);


    @Headers(value={"Content-type:application/json;charset=UTF-8"})
    @RequestLine(value = "GET /feign/provider/user/{id}")
    //@RequestMapping(value = "/feign/provider/user/{id}", method = RequestMethod.GET)
    @ResponseBody
    String getUserById(@Param("id") Integer id);


}
